class Cabinet { 
    Long id
    Long version
    String name
    String location
    def relatesToMany = [ shirts : Shirt, trousers : Trouser ]
    Set shirts = new HashSet()
    Set trousers = new HashSet()
    

    String toString() { "${this.class.name} :  $id" }
    
    boolean equals(other) {
        if(other?.is(this))return true
        if(!(other instanceof Cabinet)) return false
        
        if(!id || !other?.id || id!=other?.id) return false
        
        return true
    }
    
    int hashCode() {
        int hashCode = 0
        hashCode = 29 * (hashCode + ( !id ? 0 : id ^ (id >>> 32) ) )
    }
}   
